<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
<jsp:useBean id="selhome_friend1" scope="session" class="software.Use_user"/>
<%@ page import="java.util.ArrayList" %>
<jsp:useBean id="selhome_friend2" scope="session" class="software.Fri_done"/>
 <jsp:useBean id="selhome_friend3" class="software.Paination" scope="session"/>
  <%@ page import="software.Paination" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>
    </title>
  </head>
  <body>
   <% 
 String Id=session.getAttribute("IDsel").toString();
 int Id1=Integer.parseInt(Id);
 int k=selhome_friend2.get_friend_sum(Id1);
 if(k==0){
    %>
   <p>目前没有好友！</p>
   <%
    }
    else
    {
 List<String> list1 = selhome_friend2.Fri_get_name(Id1);
 //selhome_friend3.setTotalPages(list1.size());
 selhome_friend3.initPageBean(list1);
 %>
  <form action="selhome_friend.jsp" method="post" name="page" onsubmit="return checkPage(page)">
  <p>    
        共有<font color="red" size="1"><%=selhome_friend3.getTotalRows() %></font>个好友&nbsp; &nbsp; &nbsp; &nbsp; <a href="selhome_main.jsp">返回主页</a>
        <br/>
       当前是第<font color="red" size="1"><%=selhome_friend3.getCurrentPage()+"/"+selhome_friend3.getTotalPages() %></font>页
       </p>
       <%if(selhome_friend3.isHasPreviousPage())
       out.print("<a href='selhome_friend2.jsp?requestPage=previousPage'>上一页</a>"); %>
       <%if(selhome_friend3.isHasNextPage())
       out.print("<a href='selhome_friend2.jsp?requestPage=nextPage'>下一页</a>"); %>
       </form>
  	<%-- 分页显示--%>
     <table align="left" border="1" width="60" height="70">
     	<%
         List notes=selhome_friend3.getCurrentPageList();
           for(int m=0;m<notes.size();m++){   
           selhome_friend1.setUsername((String)notes.get(m));
    	  int Id3=selhome_friend1.getId(); 
           %>
          <tr bgcolor='#FFCC99' align="center">
          <td height="50%" width="70%">
     	 <a href="othhome_main.jsp?IDoth=<%=Id3%>&IDseloth=<%=Id1%>&mk=0"> <%=(String)notes.get(m)%></a>
     	 </td>
     	 <td width="30%">
     	 <a href="friend_delete.jsp?friendid=<%=Id3%>" onclick="return window.confirm('确定删除吗？');">删除</a>
     	 </td>
             </tr>
             <%
             }
             }
             %>
     </table>
  </body>
</html>